<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">

      <el-form-item label="项目名称" prop="projectName">
        <el-input
          v-model="queryParams.projectName"
          placeholder="请输入项目名称"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="合同标题" prop="contractTitle">
        <el-input
          v-model="queryParams.contractTitle"
          placeholder="请输入合同标题"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">

      </el-col>
    </el-row>

    <el-table v-loading="loading" :data="list" border size="mini" :height="listHeight || fillHeight('listHeight',['queryForm','add','pagination'],['hamburger-container','tags-view-container'], 130)">
      <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
      <el-table-column label="立项编码" prop="pigfarmProject.projectNumber" :show-overflow-tooltip="true" width="220" />
      <el-table-column label="项目名称" prop="pigfarmProject.projectName"  align="center"/>
      <el-table-column label="合同名称" prop="contractInfo.contractTitle"  min-width="160"  align="center"/>
      <!-- <el-table-column label="进度" prop="pigfarmProjectExt.progress"  align="center"/> -->
      <el-table-column label="计划开始" prop="pigfarmProject.beginTime"  align="center"/>
      <el-table-column label="计划结束" prop="pigfarmProject.endTime"  align="center"/>
      <el-table-column label="实际开始" prop="pigfarmProject.realBeginTime"  align="center"/>
      <el-table-column label="实际结束" prop="pigfarmProject.realEndTime"  align="center"/>
      <el-table-column label="项目经理" align="center">
        <template slot-scope="scope">
          {{scope.row.pigfarmProject?scope.row.pigfarmProject.projectManagerName:''}}
          {{scope.row.pigfarmProject?scope.row.pigfarmProject.projectManagerOa:''}}
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center">
        <template slot-scope="scope">
          <span v-show="scope.row.bpmInfo.status == '' || scope.row.bpmInfo.status == 'save' || scope.row.bpmInfo.status == null ">保存</span>
          <span v-show="scope.row.bpmInfo.status == 'active'">审批中</span>
          <span v-show="scope.row.bpmInfo.status == 'completed'">审批完成</span>
          <span v-show="scope.row.bpmInfo.status == 'cancel'">作废、取消、删除</span>
          <span v-show="scope.row.bpmInfo.status == 'reject'">退回、驳回</span>
        </template>
      </el-table-column>

      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="200" >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleChange(scope.row.id,scope.row.bpmInfo.status)"
          >反馈</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { listForm,getTreeselect,delForm} from "@/api/progressManagement/feedback";
import { roleOption } from "@/api/auth/role";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/auth/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import BaseIndex from '@/views/base/BaseIndex'
export default {
  name: "Feedback",
  components: { Treeselect },
  extends: BaseIndex,
  data() {
    return {
      listHeight:0,
      zoneList:[],
      queryParams:{
        pageNum: 1,
        pageSize: 10,
        roleName: undefined,
        roleKey: undefined,
        status: undefined,
        projectName:'',
        contractTitle:'',
      },
      props:{
        value:'id',
        label:'label'
      },
      loginOa:''
    };
  },
  watch: {

  },
  created() {
    this.loginOa = this.$store.state.user.account;
    console.log(this.ids)
    this.getList();

    getTreeselect().then(
      response => {
        if(response && response.code ===0){
          this.zoneList = response.data
        }else{
          this.msgError(response.msg)
        }
        this.loading = false;
      }
    );

  },
  methods: {
    listForm,
    delForm,
    handleChange(id,status){  // 修改
      this.$router.push({path: "feedbackDetails", query: {
        type:'change',
        id,
        status,
      }});
    },

    handleAddFn(){
      this.$router.push({path: "feedbackDetails", query: {
        type:'add'
      }});
    },
    handleDetails(id){
      this.$router.push({path: "feedbackDetails", query: {
        type:'details',
        id
      }});
    }
  }
};
</script>
